Skip to content

[common] Improved performance of Group MXFP8 kernels - #3337

Open
Oleg-Goncharov wants to merge 3 commits into
NVIDIA:mainfrom
Oleg-Goncharov:pr_mxfp8_group_kernels_optimization
Open

[common] Improved performance of Group MXFP8 kernels#3337
Oleg-Goncharov wants to merge 3 commits into
NVIDIA:mainfrom
Oleg-Goncharov:pr_mxfp8_group_kernels_optimization

Conversation

@Oleg-Goncharov

@Oleg-Goncharov Oleg-Goncharov commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR optimizes grouped MXFP8 quantization by introducing layout-specific kernel configurations and work scheduling strategies.

Groups with uniform shapes or a common last dimension use direct CTA-to-chunk mapping, while layouts requiring per-tensor TMA descriptors use per-tensor persistent scheduling. The kernel processes larger chunks through multiple stages, reducing scheduling and tensor-mapping overhead for large grouped workloads.

The change also ensures that dynamically updated TMA descriptors are acquired before use, handles graph-safe logical capacity without out-of-bounds accesses, and preserves correct dBias workspace behavior across multi-chunk execution.

Type of change

  • Documentation change (change only to the documentation, either a fix or a new content)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Infra/Build change
  • Code refactoring

Changes

  • Extend grouped TMA storage with per-tensor row, column, and offset metadata.
  • Introduce layout-specific grouped MXFP8 kernel configurations and compile-time traits.
  • Use direct CTA-to-chunk mapping for SAME_BOTH_DIMS and VARYING_FIRST_DIM layouts.
  • Use per-tensor persistent scheduling for VARYING_LAST_DIM and VARYING_BOTH_DIMS layouts.
  • Process 128x128 and 128x256 chunks through multiple X/Y stages.
  • Acquire dynamically updated TMA descriptors before they are consumed by the quantization kernel.
  • Avoid out-of-bounds accesses when graph-safe logical capacity exceeds the active tensor range.
  • Preserve correct rowwise, columnwise, and bidirectional scaling behavior.
  • Preserve correct dBias accumulation and workspace reduction for multi-chunk execution.
  • Add focused regression coverage for all grouped shape representations, multi-chunk dBias/dAct execution, and the maximum of 64 dynamic TMA descriptors.
  • Keep all existing dispatch paths, operator tests, and CUDA architecture targets enabled.

Runtime Speedup Factor on GB300

image image image

Checklist:

  • I have read and followed the contributing guidelines
  • The functionality is complete
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Oleg-Goncharov and others added 2 commits August 10, 2026 13:23
Signed-off-by: Oleg Goncharov <ogoncharov@nvidia.com>
@greptile-apps

greptile-apps Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR restructures grouped MXFP8 quantization around layout-specific launch configurations and multi-stage chunk processing.

  • Adds direct chunk scheduling for uniform/common-last-dimension layouts.
  • Adds tensor-local persistent scheduling and metadata for layouts using dynamic TMA descriptors.
  • Extends multi-chunk scaling and dBias handling.
  • Adds focused CUDA regression cases for multi-chunk workloads and 64 descriptors.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains within the eligible follow-up review scope.

No blocking failure remains.

Important Files Changed

Filename Overview
transformer_engine/common/cast/mxfp8/group_quantize_mxfp8.cuh Introduces layout-specific launch traits, direct and persistent scheduling, multi-stage chunk traversal, descriptor acquisition, and updated dBias workspace handling.
transformer_engine/common/cast/core/grouped_tma.cuh Extends grouped TMA storage with tensor-local row, column, and element-offset metadata populated alongside dynamic descriptors.
tests/cpp/operator/test_cast_mxfp8_grouped.cu Adds focused numerical coverage for multi-chunk scaling, dBias/dAct execution, all grouped shape representations, and the 64-descriptor limit.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Grouped MXFP8 quantization] --> B{Shape representation}
  B -->|SAME_BOTH_DIMS| C[Direct CTA-to-chunk mapping]
  B -->|VARYING_FIRST_DIM| C
  B -->|VARYING_LAST_DIM| D[Per-tensor persistent scheduling]
  B -->|VARYING_BOTH_DIMS| D
  D --> E[Read tensor-local dimensions and TMA descriptors]
  C --> F[Process multi-stage Y/X chunk]
  E --> F
  F --> G[Write rowwise or colwise output and scales]
  F --> H[Accumulate optional dBias workspace]
  H --> I[Grouped dBias reduction]
Loading

Reviews (2): Last reviewed commit: "Merge branch 'main' into pr_mxfp8_group_..." | Re-trigger Greptile

@ptrendx ptrendx self-assigned this Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants